<?php
$this->load->view('template/head_view');
$this->load->view('template/cabecario_view');
?>
<link href="<?php echo base_url() ?>css/screen.css" rel="stylesheet" type="text/css" media="screen" />   
<div id="welcome" class="conteudo">
    <?php
    if (isset($message)) {
        echo "<div class='alert $type'>" . $message . "</div>";
    }
    ?>
    <div >
        <div class="panel-body">
            <?php
            if (isset($_SESSION[$this->Autenticacao_model->ID_SESSION])) {
                if ($this->Autenticacao_model->isCliente()) {
                    $url = base_url() . "cliente/cliente";
                } else if ($this->Autenticacao_model->isFuncionario()) {
                    $url = base_url() . "funcionario/funcionario";
                } else {
                    $url = base_url() . "admin/admin";
                }
                ?>
                <div  class="panel panel-default panel-body">
                    <a href="<?php echo $url ?>" class="btn btn-default" >Sistema</a>
                </div>
            <?php }else{?>
                <div style="float: left; width: 50%" class="panel panel-default panel-body">
                    <form method="POST" action="<?php echo base_url() ?>autenticacao/cadastro">
                        <fieldset style="width: 75%;margin: auto;">
                            <legend>Cadastro</legend>
                            <div class="input-group">
                                <span class="input-group-addon">Nome</span>
                                <input type="text" name="ip_nome" class="form-control" required="true" value="<?php
                                if (isset($nome)) {
                                    echo $nome;
                                }
                                ?>">
                            </div><br/>
                            <div class="input-group">
                                <span class="input-group-addon">Login</span>
                                <input type="text" name="ip_login" class="form-control" required="true" value="<?php
                                if (isset($login)) {
                                    echo $login;
                                }
                                ?>" onchange="validarlogin(this, '#span_login');">
                                <div id="span_login"></div>
                            </div><br/>
                            <div class="input-group">
                                <span class="input-group-addon">Senha</span>
                                <input type="password" name="ip_senha" class="form-control"  required="true">
                            </div><br/>
                            <div class="input-group">
                                <span class="input-group-addon">Confirmar a Senha</span>
                                <input type="password" name="ip_confirmaSenha" class="form-control"  required="true">
                            </div><br/>
                            <div class="input-group">
                                <span class="input-group-addon">Email</span>
                                <input type="email" name="ip_email" class="form-control" required="true" value="<?php
                                if (isset($email)) {
                                    echo $email;
                                }
                                ?>">
                            </div><br/>
                            <input type="submit" class="btn btn-default" value="Cadastre-se">
                        </fieldset>
                    </form>
                </div>
                <div style="float: left; width: 50%" class="panel panel-default panel-body">
                    <form method="POST" action="<?php echo base_url() ?>autenticacao/login">
                        <fieldset style="width: 75%;margin: auto;">
                            <legend>Acessar</legend>
                            <div class="input-group">
                                <input type="text" name="ip_login" class="form-control" placeholder="Login" required="true" >
                            </div><br/>
                            <div class="input-group">
                                <input type="password" name="ip_senha"class="form-control" placeholder="Senha" required="true" >
                            </div><br/>
                            <input type="submit" class="btn btn-default" value="Entrar">
                        </fieldset>
                    </form>
                </div>
            <?php } ?>
        </div>        
    </div>
</div>
<script type="text/javascript" src="<?php echo javaScriptJQuery() ?>"></script>
<script type="text/javascript" src="<?php echo javaScriptBootStrap() ?>"></script>
<script type="text/javascript" src="<?php echo javaScriptApplicationValidation() ?>"></script>
<?php
$this->load->view('template/rodape_view');